package io.iec.edp.caf.tenancy.service.config;

import io.iec.edp.caf.rest.RESTEndpoint;
import io.iec.edp.caf.tenancy.service.ITenancyRestService;
import io.iec.edp.caf.tenancy.service.api.TenancyRestServiceImpl;
import io.iec.edp.caf.tenancy.service.manager.TenancyRestService;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
@EntityScan("io.iec.edp.caf.tenancy.api.*")
public class TenancyRestServiceConfiguration {

    @Bean
    public ITenancyRestService createRestServiceApi(TenancyRestService tenancyRestService){
        return new TenancyRestServiceImpl(tenancyRestService);
    }

    @Bean
    public TenancyRestService createTenantRestService(){return new TenancyRestService();}

    @Bean
    public RESTEndpoint tenancyRest(ITenancyRestService rest) {
        return new RESTEndpoint("/runtime/sys/v1.0/tenancy", rest);
    }

}
